﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XMLSpreadGear.Core;

namespace XMLSpreadGear.Headers
{
    public class Border:MultiElement<Border>
    {
        private Position m_position;
        private string m_Color;
        private LineStyle? m_LineStyle;
        private double? m_Weigh;

        public Border(Position position)
            : base(LocalNames.BORDER)
        {
            this.Position = position;
        }

        public Border(Position position,string color,LineStyle lineStyle,double weight)
            : this(position)
        {
            this.LineStyle = lineStyle;
            this.Color = color;
            this.Weight = weight;
          
        }


        public Position Position
        {
            get { return m_position; }
            set { m_position = value; }
        }      
        public string Color
        {
            get { return m_Color; }
            set { m_Color = value; }
        }
        public LineStyle? LineStyle
        {
            get { return m_LineStyle; }
            set { m_LineStyle = value; }
        }   
        public double? Weight
        {
            get { return m_Weigh; }
            set { m_Weigh = value; }
        }



        internal protected override IDictionary<string, string> RegisterAttributes()
        {
            IDictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add("Position", Enum.GetName(typeof(Position), this.Position));

            if(!string.IsNullOrEmpty(this.Color))
                dic.Add("Color", this.Color);

            if(this.LineStyle != null)
                dic.Add("LineStyle", Enum.GetName(typeof(LineStyle), this.LineStyle));
            
            if(this.Weight != null)
                dic.Add("Weight", this.Weight.ToString());
           return dic;
        }

        internal protected override IDictionary<string, string> RegisterElements()
        {
            IDictionary<string, string> dic = new Dictionary<string, string>();
            return dic;
        }

        protected override void SetDefaults()
        {
            return;
        }

        internal override string GetAttributeNamespace()
        {
            return Contstants.SpredsheetAttributePrefix;
        }

        internal override string GetAttributeNamespaceURI()
        {
            return Contstants.SpredsheetAttributeNamespace;
        }
    }
}
